"""
Copyright (C)2010 Humanetrix Foundation, Inc.

This file is a part of the GROUP MATCH PYTHON. GROUP MATCH PYTHON is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses>.

About this Project
------------------
GROUP MATCH PYTHON was the outcome of Dev Derby (http://devderby.com), held in Bloomington, Indiana on September 11, 2010. The challenge was to build a system to allow groups to offer services to non-profits and manage feedback on prior volunteer efforts, initiating the flow of quality human resources to the organizations that need them. This had to be done in one six-hour session.

Five teams representing different programming languages competed in this first event. Team Python includes:

	Charles Brandt, Team Lead 
	Rajesh Gollapudi 
	Vijay Lulla 
	Josh Dolitsky

Questions or comments should be directed to info@devderby.com.
"""
import datetime
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext.db import polymodel
from google.appengine.ext import webapp
import skills
# for skills, we will have a large table of check boxes
# with skills, and a multi-line textbox for custom skills-Abe

class PhoneContact(db.Model):
    """Fields are 
       phone_number : PhoneNumberProperty
       phone_type : one of ["work", "hone", "cell"]
    """
    phone_number = db.PhoneNumberProperty()
    phone_type = db.StringProperty(required=True, choices=set(["work", "home", "cell"]))


class Volunteer(db.Model):
    fname = db.StringProperty(required=True)
    lname = db.StringProperty(required=True)
    email = db.EmailProperty(required=True)
    phone = db.ReferenceProperty(PhoneContact)
    start_date = db.DateTimeProperty(required=True)
    end_date = db.DateTimeProperty(required=True)
	
    def __init__(self, skills, custom_skills, **kwargs):
        db.Model.__init__(self, kwargs)
        self.skills = skills.SkillGroup(skills)
        for i in custom_skills:
            self.skills.set_skill(i)

class ListVolunteer(webapp.RequestHandler):
    def get(self):
        self.response.out.write('<html><body>')
        volunteers = db.GqlQuery("SELECT * from Volunteer LIMIT 10")

        for v in volunteers:
          self.response.out.write("<div><b>%s, %s</b>" % (v.lname, v.lname))
        self.response.out.write('</body></html>')

class NewVolunteer(webapp.RequestHandler):
    def post(self):
        self.response.out.write("<html><body></body></html>")
